<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Person() {
      this.name = '小明'
      this.arr = [1]
      this.getName = function () {
        console.log(this.name)
      }
    }
    Person.prototype.myFn=function(){
      console.log('我是父构造函数原型上的方法')
    }
    function Student() { 
      Person.call(this)
    }

    const fn=function(){}
    fn.prototype=Person.prototype
    console.log(new fn())
    Student.prototype = new fn()
    const p1 = new Person()
    console.log(p1,'Person实例')
    console.log(p1.name,'Person实例的name')
    console.log(p1.arr,'Person实例的arr')
    p1.myFn()
    console.log('---------------------------------')
    const s1 = new Student()
    s1.name = '小花'
    s1.arr.push(2,3)
    console.log(s1,'Student实例')
    console.log(s1.name,'Student实例的name')
    console.log(s1.arr,'Student实例的arr')
    // s1.myFn()
    console.log('---------------------------------')
    const s2 = new Student()
    s2.name = '小化'
    // s2.arr.push(2,3,4,5,6)
    console.log(s2,'Student实例')
    console.log(s2.name,'Student实例的name')
    console.log(s2.arr,'Student实例的arr')
    s2.myFn()
    console.log(s2)
  </script>
</body>

</html>